package com.uucrazy.datacenter.data;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 用户信息
 * 
 * @author Crazy24k@gmail.com
 * 
 */
public class BaseUser implements User
{

	private String id;
	private String name;
	private String avatar;
	private Map<String,Attribute> attributes = new HashMap<String,Attribute>();

	public void setId(String id)
	{
		this.id = id;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public void setAvatar(String avatar)
	{
		this.avatar = avatar;
	}

	@Override
	public String getAvatar()
	{
		return this.avatar;
	}

	@Override
	public String getId()
	{
		return this.id;
	}

	@Override
	public String getName()
	{
		return this.name;
	}

	@Override
	public Attribute getAttribute(String key)
	{
		return attributes.get(key);
	}

	@Override
	public Collection<Attribute> getAttributes()
	{
		return attributes.values();
	}
	
	public void addAttribute(Attribute attr)
	{
		attributes.put(attr.getKey(), attr);
	}
	
	public void removeAttribute(String key)
	{
		attributes.remove(key);
	}
}
